﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Principal.Master" AutoEventWireup="true" CodeBehind="RegistroAdministradores.aspx.cs" Inherits="SistemaInformativoTuristico.Formulario_web15" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder3" runat="server">
    <table style="width: 62%;">
    <tr>
        <td style="width: 124px">Id Admin:</td>
        <td style="width: 215px">
            <asp:Label ID="lbl_ID" runat="server" Text="1"></asp:Label>
        </td>
    </tr>
    <tr>
        <td style="width: 124px">Nombre:</td>
        <td style="width: 215px">
            <asp:TextBox ID="txtNombre" runat="server" Width="162px"></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td style="height: 24px; width: 124px">Contraseña:</td>
        <td style="height: 24px; width: 215px">
            <asp:TextBox ID="txtContra" runat="server" Width="161px"></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td style="height: 24px; width: 124px">Cédula:</td>
        <td style="height: 24px; width: 215px">
            <asp:TextBox ID="txtCedula" runat="server" Width="160px"></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td style="height: 24px; width: 124px">Teléfono:</td>
        <td style="height: 24px; width: 215px">
            <asp:TextBox ID="txtTelefono" runat="server" Width="158px"></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td colspan="2" style="height: 22px">
            <asp:Button ID="btnNuevo" runat="server" Text="Nuevo" />
            <asp:Button ID="btnGuardar" runat="server" OnClick="btnGuardar_Click" Text="Guardar" />
            <asp:Button ID="btnEliminar" runat="server" Text="Eliminar" />
        </td>
    </tr>
    <tr>
        <td colspan="2" style="height: 24px">Buscar por Cédula:<asp:TextBox ID="txtBuscar" runat="server" Width="150px"></asp:TextBox>
            <asp:Button ID="btnBuscar" runat="server" Text="Buscar" />
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:SistematurismoConnectionString %>" SelectCommand="SELECT * FROM [administrador]"></asp:SqlDataSource>
            <asp:LinqDataSource ID="LinqDataSource1" runat="server">
            </asp:LinqDataSource>
            <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="id_admin" DataSourceID="SqlDataSource2" EmptyDataText="No hay registros de datos para mostrar." Height="182px">
                <Columns>
                    <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
                    <asp:BoundField DataField="id_admin" HeaderText="id_admin" ReadOnly="True" SortExpression="id_admin" />
                    <asp:BoundField DataField="nombre" HeaderText="nombre" SortExpression="nombre" />
                    <asp:BoundField DataField="contra" HeaderText="contra" SortExpression="contra" />
                    <asp:BoundField DataField="cedula" HeaderText="cedula" SortExpression="cedula" />
                    <asp:BoundField DataField="telefono" HeaderText="telefono" SortExpression="telefono" />
                </Columns>
            </asp:GridView>
            <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:SistematurismoConnectionString %>" DeleteCommand="DELETE FROM [administrador] WHERE [id_admin] = @id_admin" InsertCommand="INSERT INTO [administrador] ([id_admin], [nombre], [contra], [cedula], [telefono]) VALUES (@id_admin, @nombre, @contra, @cedula, @telefono)" ProviderName="<%$ ConnectionStrings:SistematurismoConnectionString.ProviderName %>" SelectCommand="SELECT [id_admin], [nombre], [contra], [cedula], [telefono] FROM [administrador]" UpdateCommand="UPDATE [administrador] SET [nombre] = @nombre, [contra] = @contra, [cedula] = @cedula, [telefono] = @telefono WHERE [id_admin] = @id_admin">
                <DeleteParameters>
                    <asp:Parameter Name="id_admin" Type="Int32" />
                </DeleteParameters>
                <InsertParameters>
                    <asp:Parameter Name="id_admin" Type="Int32" />
                    <asp:Parameter Name="nombre" Type="String" />
                    <asp:Parameter Name="contra" Type="String" />
                    <asp:Parameter Name="cedula" Type="String" />
                    <asp:Parameter Name="telefono" Type="String" />
                </InsertParameters>
                <UpdateParameters>
                    <asp:Parameter Name="nombre" Type="String" />
                    <asp:Parameter Name="contra" Type="String" />
                    <asp:Parameter Name="cedula" Type="String" />
                    <asp:Parameter Name="telefono" Type="String" />
                    <asp:Parameter Name="id_admin" Type="Int32" />
                </UpdateParameters>
            </asp:SqlDataSource>
        </td>
    </tr>
</table>
</asp:Content>
